package cn.edu.heuet.bnve.activity.ScheduleActivity;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;

import com.haibin.calendarview.Calendar;
import com.haibin.calendarview.CalendarView;

import cn.edu.heuet.bnve.R;
import cn.edu.heuet.bnve.databinding.DialogSelectDayBinding;

public class SetDayDialog extends Dialog  {

    DialogSelectDayBinding binding;

    CalendarView mCalendarView;

    TextView mTextMonthDay;

    TextView mTextYear;

    TextView mTextLunar;

    public Calendar selectedCalender;

    Button okButton;
    Button cancelButton;

    public SetDayDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);

    }

    public SetDayDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.dialog_select_day);
        binding = DataBindingUtil.inflate(LayoutInflater.from(getContext()),
                R.layout.dialog_select_day, null, false);
        //按空白处不能取消动画
//        setCanceledOnTouchOutside(false);
        //初始化界面控件
        initView();
        //初始化界面数据
        initData();
        //初始化界面控件的事件
        initEvent();
    }

    private void initView(){

        mCalendarView = binding.calendarView;

        mTextLunar = binding.tvLunar;
        mTextMonthDay = binding.tvMonthDay;
        mTextYear = binding.tvYear;
        okButton = binding.buttonOk;
        cancelButton = binding.buttonCancel;

        selectedCalender = mCalendarView.getSelectedCalendar();

        mTextYear.setText(String.valueOf(mCalendarView.getCurYear()));
        mTextMonthDay.setText(mCalendarView.getCurMonth() + "月" + mCalendarView.getCurDay() + "日");
        mTextLunar.setText("今日");


    }
    private void initData(){

    }
    private void initEvent() {

    }
}
